<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<PersonalAlbumModel>" %>
<%@ Import Namespace="MyAlbum.Model" %>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<span class="error">
<%=Html.Encode(Model.ErrorMessage) %>
</span>
<table>
    <thead>
        <tr>
            <th><%=Model.Localize("Config.Name") %></th>
            <th><%=Model.Localize("Config.Value") %></th>
            <th><%=Model.Localize("Config.Description")  %></th>
        </tr>
    </thead>
   
    <tr>
        <td colspan="3">
         <%using (Html.BeginForm<AdminController>(a => a.UpdateConfig(), FormMethod.Post, new { id = "configForm" }))
           { %>
           <%=Html.AntiForgeryToken()%>
         <table style="width:100%">
    <%
             string lastId = null;
             if (ViewData["lastId"] != null)
             {
                 lastId = ViewData["lastId"].ToString();
             }
             foreach (ConfigItem item in Model.Configuration.Items)
             { %>
            <tr>
                <td <%=(lastId == item.Name)?"style=\"background-color:Yellow\"":null %>>
                    <%=Html.Encode(item.Name)%>
                </td>
                <td>
                  <%=item.ToHtml() %>
                </td>
                  <td>
                    <%=Html.TextArea(item.Name + "_Description", item.Description,3,30,null)%>
                </td>
                <td>
               <%-- <%=Html.ActionLink<ConfigController>(c=>c.Delete(item.Id), Model.Localize("Config.Delete"))%>--%>
                </td>
            </tr>
        
        <%} %>
      
  
    </table>    
     
      
      <br />
      <input type="submit" value="<%=Model.Localize("Config.Save") %>" />
     <%} %>
    </td>
    </tr>
</table>
<script type="text/javascript">
    $(document).ready(function() {
        $('#configForm').validate();
    });
    
</script>
</asp:Content>